use glob::glob;
use yaml2toml::{parse::zola, yaml2toml};
fn main() -> anyhow::Result<()> {
    let current_dir = std::env::current_dir()?;
    let input = std::env::args().nth(1).unwrap_or("".to_string());
    let dir = current_dir.join(input);

    for file in glob(dir.as_os_str().to_str().unwrap())? {
        let file = file?;
        match yaml2toml(&file, &file, zola) {
            Ok(_) => {
                println!("transformed {:?}", file);
            }
            Err(e) => {
                println!("skipped {:?} for {:?}", file, e);
            }
        }
    }

    Ok(())
}
